<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fmtt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html>
<html>
<head>
    <script type="text/javascript" src="/myhouse/static/manager/js/jquery-3.2.1.min.js"></script>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="/myhouse/static/manager/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="/myhouse/static/manager/css/main.css"/>
    <script type="text/javascript" src="/myhouse/static/manager/js/libs/modernizr.min.js"></script>
</head>
<body>
<jsp:include page="/inc/managerHead.jsp"></jsp:include>
<div class="container clearfix">
    <jsp:include page="/inc/managerLeft.jsp"></jsp:include>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/myhouse/manager/index">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">用户管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="/myhouse/manager/userByName" method="get" id="sub">
                    <table class="search-tab">
                        <tr>
                            <th width="70">搜索:</th>
                            <td><input class="common-text" name="userName"  type="text" id="username"></td>
                            <td><input class="btn btn-primary btn2" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>

        <script type="text/javascript">
            $(function (){
                $("#sub").submit(userByName);
            });
            function userByName(){
                if ($("#username").val() == ""){
                    return false;
                }else {
                    return true;
                }
            }
        </script>

        <c:if test="${empty requestScope.user}">
            <span style="font-size: 50px; position: relative; top: 100px;left: 500px">没有该用户</span>
        </c:if>
        <c:if test="${not empty requestScope.user}">
        <div class="result-wrap">
            <form>
                    <%--                <div class="result-title">--%>
                    <%--                    <div class="result-list">--%>
                    <%--                        <a href="/myhouse/manager/insert"><i class="icon-font"></i>新增作品</a>--%>
                    <%--                        <a id="batchDel" href="/myhouse/manager/javascript:void(0)"><i class="icon-font"></i>批量删除</a>--%>
                    <%--                    </div>--%>
                    <%--                </div>--%>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                                <%--                            <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>--%>
                            <th>用户名</th>
                            <th>邮箱</th>
                            <th>手机号</th>
                            <th>注册时间</th>
                            <th>账号状态</th>
                            <th>操作</th>
                        </tr>
                        <tr>
                                <%--                            <td class="tc"><input name="id[]" value="59" type="checkbox"></td>--%>
                            <td>${requestScope.user.userName}</td>
                            <td>${requestScope.user.userEmail}</td>
                            <td>${requestScope.user.userPhone}</td>
                            <td><fmtt:formatDate value="${user.userRegtime}" pattern="yyyy-MM-dd HH:mm:ss"></fmtt:formatDate></td>
<%--                            <td>${requestScope.user.officeAddress}</td>--%>
                            <td>
                                <c:if test="${requestScope.user.userBan == true}">
                                    正常
                                </c:if>
                                <c:if test="${requestScope.user.userBan == false}">
                                    封禁
                                </c:if>
                            </td>
                            <td>
                                <c:if test="${requestScope.user.userBan == true}">
                                    <a href="/myhouse/manager/banUser?id=${requestScope.user.id}&&ban=${requestScope.user.userBan}">封禁</a>
                                </c:if>
                                <c:if test="${requestScope.user.userBan == false}">
                                    <a href="/myhouse/manager/banUser?id=${requestScope.user.id}&&ban=${requestScope.user.userBan}">解封</a>
                                </c:if>
                            </td>
                        </tr>
                    </table>
                </div>
            </form>
        </div>
    </div>
    </c:if>
    <!--/main-->
</div>
</body>
</html>